package org.zht.dormpro.dorm.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.zht.dormpro.dorm.model.TbRetire;

public interface TbRetireMapper {
    @Delete({
        "delete from tb_retire",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    @Insert({
        "insert into tb_retire (id, dorm_id, ",
        "stu_id, retire_status, ",
        "retire_remark, record_time, ",
        "record_append, record_status)",
        "values (#{id,jdbcType=INTEGER}, #{dormId,jdbcType=VARCHAR}, ",
        "#{stuId,jdbcType=VARCHAR}, #{retireStatus,jdbcType=TINYINT}, ",
        "#{retireRemark,jdbcType=VARCHAR}, #{recordTime,jdbcType=BIGINT}, ",
        "#{recordAppend,jdbcType=VARCHAR}, #{recordStatus,jdbcType=TINYINT})"
    })
    int insert(TbRetire record);

    int insertSelective(TbRetire record);

    @Select({
        "select",
        "id, dorm_id, stu_id, retire_status, retire_remark, record_time, record_append, ",
        "record_status",
        "from tb_retire",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @ResultMap("org.zht.dormpro.dorm.mapper.TbRetireMapper.BaseResultMap")
    TbRetire selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(TbRetire record);

    @Update({
        "update tb_retire",
        "set dorm_id = #{dormId,jdbcType=VARCHAR},",
          "stu_id = #{stuId,jdbcType=VARCHAR},",
          "retire_status = #{retireStatus,jdbcType=TINYINT},",
          "retire_remark = #{retireRemark,jdbcType=VARCHAR},",
          "record_time = #{recordTime,jdbcType=BIGINT},",
          "record_append = #{recordAppend,jdbcType=VARCHAR},",
          "record_status = #{recordStatus,jdbcType=TINYINT}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(TbRetire record);
}